<template>
  <div class="common-layout">
    <el-container>
      <el-header>
        <Top></Top>
      </el-header>
      <el-container>
        <el-aside width="200px" >
          <div v-if="businessInfo == null && adminInfo == null"></div>
          <div>
            <LeftMenu></LeftMenu>
          </div>
        </el-aside>
        <el-main>
        <div v-if="businessInfo == null && adminInfo == null" class="boxs">
        <el-card>
              <div>
                <el-button type="primary" @click="this.$router.push('/adminLogin')" size="large">管理员登录</el-button>
                <el-button type="primary" @click="this.$router.push('/busLogin')" size="large">商家登录</el-button>
              </div>
          </el-card>
        </div>
        <div v-else>
          <RouterView></RouterView>
        </div>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import Top from '@/components/Top.vue'
import LeftMenu from '@/components/LeftMenu.vue'
import { RouterView } from "vue-router"
export default {
  components: { Top, LeftMenu, RouterView },
  data(){
    return {
      businessInfo:{},
      adminInfo:{},
    }
  },
  created(){
    let info = sessionStorage.getItem("business");
        let info1 = sessionStorage.getItem("admin");
        if (!info) {
            this.adminInfo = JSON.parse(info1);
        }
        this.businessInfo = JSON.parse(info);
  }
}
</script>

<style scoped>
.boxs {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.el-card {
    width: 500px;
    height: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.common-layout,
.el-container {
  height: 100%;
}

.el-header {
  padding: 0 50px;
  background-color: #c1ffc1;
  /* 字符之间的间距 */
  letter-spacing: 1em;
}

.el-aside {
  background-color: #ccffff;
}

.el-main {
  background-color: #effff7;
}
</style>